package com.class05;

/**
 * @ClassDescription:
 * 测试运算符的使用1：算数运算符的使用
 * 1.+ - * / %  (前)++  (后)++  (前)--  (后)--
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/12/27 18:43
 */
public class AriTest7 {
    public static void main(String[] args) {
        //    除法：/
        int m1 = 14;
        int n1 = 5;
        int k1 = m1 / n1;
        System.out.println("k1 = " + k1);
        System.out.println(14*5/2);
//        取模(或取余)：%
        int i1 = 12;
        int j1 = 5;
        System.out.println(i1 % j1);//2
//        System.out.println(i1+j1-i1*j1);//17-60
//   开发中，经常用来判断某数num1能整除另外一个num2。num1%num2 == 0
//        比如：判断num1是否是偶数：num1%2 == 0
//        结论：取模以后，结果与被模数的符号相同。
        int i2 = -12;
        int j2 = 5;
        System.out.println(i2%j2);//-2
        int i3 = 12;
        int j3 = -5;
        System.out.println(i3%j3);//2
        int i4 = -12;
        int j4 = -5;
        System.out.println(i4%j4);//-2

//        =================================
//        (前)++：先自增1，再运算
//        (后)++：先运算，后自增1
        int a1 = 10;
        System.out.println(++a1);
        int a2 = 10;
        System.out.println(a2++);
        int a3 = ++a1%2*3;
        System.out.println(a3);
        System.out.println(a3++);
        System.out.println(a3);

//        (前)--：先自减1，再运算
//        (后)--：先运算，后自减1
//        int a5 = 10;
//        System.out.println(a5--);//10
//        System.out.println(--a5);//8
        int a6 = 10;
        System.out.println( ++a6%2*3*5%2);

    }


    
    
    
}
